package com.xrx.webtemplate.web.service.biz;

import com.xrx.webtemplate.model.ShiroSessionModel;
import com.xrx.webtemplate.web.service.dao.TokenApiDao;
import org.apache.shiro.session.Session;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.io.Serializable;
import java.util.Collection;
import java.util.HashMap;
import java.util.Map;

/**
 * Created by xierongxian on 2017/4/24.
 */
@Service("tokenApiBiz")
public class TokenApiBiz {

    @Autowired
    private TokenApiDao tokenApiDao;


    public void saveSession(ShiroSessionModel shiroSessionModel) {
        tokenApiDao.saveSession(shiroSessionModel);
    }

    public  void updateSession(ShiroSessionModel shiroSessionModel){
        tokenApiDao.updateSession(shiroSessionModel);
    }

    public void refreshSession(String sessionId) {
        tokenApiDao.refreshSession(sessionId);
    }

    public void deleteSession(String sessionId) {

        tokenApiDao.deleteSession(sessionId);
    }

    public ShiroSessionModel getSession(String sessionId) {
        Map<String,Object> map=new HashMap<String, Object>();
        map.put("sessionid",sessionId);
        return tokenApiDao.getSession(map);

    }

    public Collection<Session> getAllSessions() {
        return null;
    }


}
